/**
 * 
 * If you have edited the file, please update
 * all the last-modified fields manually. Thanks!
 *
 * @last-modified by: 
 * @last-modified date: 
 * @last-modified time: 
 *
 * @author Swee Zhi
 * @date-created Sep 12, 2011    @time-created 6:57:41 PM
 *
 * @project: 
 * @module: 
 * @institution: 
 *
 */
package util.enumhelper;

import util.enumeration.Language;

public class LocalizedLanguage {

    // alphabetical order
    public static String getLocalizedLanguageAsString(Language language, String locale) {
        String localizedLanguage = "";
        
        // en_US ENGLISH, UNITED STATES
        if (locale.equals(SupportedLocale.getSupportedLocaleStringByLanguage(Language.ENGLISH_US))) {
            localizedLanguage = getLanguage_EN_US(language);
        }
        // en_SG ENGLISH, SINGAPORE
        else
        if (locale.equals(SupportedLocale.getSupportedLocaleStringByLanguage(Language.ENGLISH_SINGAPORE))) {
            localizedLanguage = getLanguage_EN_SG(language);
        }
        // ms_MY MALAY, MALAYSIA
        else
        if (locale.equals(SupportedLocale.getSupportedLocaleStringByLanguage(Language.MALAY))) {
            localizedLanguage = getLanguage_MS_MY(language);
        }
        
        // zh_CN CHINESE, CHINA
        else
        if (locale.equals(SupportedLocale.getSupportedLocaleStringByLanguage(Language.CHINESE_CHINA))) {
            localizedLanguage = getLanguage_ZH_CN(language);
        }
        // other language...
        else {
            localizedLanguage = getLanguage_EN_US(language);
        }
        
        return localizedLanguage;
    }
    
    // simplified chinese (zh_CN)
    private static String getLanguage_ZH_CN(Language language) {
        String localizedLanguage = "";
        
        switch (language) {
            case CHINESE_CHINA: localizedLanguage = "简体中文" ; break;
            case ENGLISH_US: localizedLanguage = "English (US)"; break;
            case ENGLISH_SINGAPORE: localizedLanguage = "English (Singapore)"; break;
            case MALAY: localizedLanguage = "Bahasa Malaysia"; break;
        }
        return localizedLanguage;
    }
    
    // default (en_US)
    private static String getLanguage_EN_US(Language language) {
        String localizedLanguage = "";
        
        switch (language) {
            case CHINESE_CHINA: localizedLanguage = "简体中文" ; break;
            case ENGLISH_US: localizedLanguage = "English (US)"; break;
            case ENGLISH_SINGAPORE: localizedLanguage = "English (Singapore)"; break;
            case MALAY: localizedLanguage = "Bahasa Malaysia"; break;
        }
        return localizedLanguage;
    }
    
    // singapore english (en_SG)
    private static String getLanguage_EN_SG(Language language) {
        String localizedLanguage = "";
        
        switch (language) {
            case CHINESE_CHINA: localizedLanguage = "简体中文" ; break;
            case ENGLISH_US: localizedLanguage = "English (US)"; break;
            case ENGLISH_SINGAPORE: localizedLanguage = "English (Singapore)"; break;
            case MALAY: localizedLanguage = "Bahasa Malaysia"; break;
        }
        return localizedLanguage;
    }
    
    // bahasa malaysia (ms_MY)
    private static String getLanguage_MS_MY(Language language) {
        String localizedLanguage = "";
        
        switch (language) {
            case CHINESE_CHINA: localizedLanguage = "简体中文" ; break;
            case ENGLISH_US: localizedLanguage = "English (US)"; break;
            case ENGLISH_SINGAPORE: localizedLanguage = "English (Singapore)"; break;
            case MALAY: localizedLanguage = "Bahasa Malaysia"; break;
        }
        return localizedLanguage;
    }
    
    // new language for localized language template (copy and paste to use)
//    private static String getLanguage_XX_YY(Language language) {
//        String localizedLanguage = "";
//        
//        switch (language) {
//            case CHINESE_CHINA: localizedLanguage = ""; break;
//            case ENGLISH_US: localizedLanguage = ""; break;
//            case ENGLISH_SINGAPORE: localizedLanguage = ""; break;
//            case MALAY: localizedLanguage = ""; break;
//        }
//        return localizedLanguage;
//    }
}
